<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>  
    </head>
    <body>
	
	<?php if(Yii::app()->user->hasFlash('successu')):?>
		<div align="center" style="background-color:#46BCD2;">
			<?php echo Yii::app()->user->getFlash('successu'); ?>
		</div>
	<?php endif; ?>
	
    <?php
		foreach ($event->when as $when) {
		  $startTime = strtotime($when->startTime);
		  $endTime = strtotime($when->endTime);
		}
		
		$title = $event->title;
		$sdate_dd = date('d', $startTime);
		$sdate_mm = date('m', $startTime);
		$sdate_yy = date('Y', $startTime);
		$sdate_hh = date('H', $startTime);
		$sdate_ii = date('i', $startTime);
		$edate_dd = date('d', $endTime);
		$edate_mm = date('m', $endTime);
		$edate_yy = date('Y', $endTime);
		$edate_hh = date('H', $endTime);
		$edate_ii = date('i', $endTime);
		$startTime = $sdate_yy . '-' . $sdate_mm . '-' . $sdate_dd . ' ' . $sdate_hh . ':' . $sdate_ii;
		$endTime = $edate_yy . '-' . $edate_mm . '-' . $edate_dd . ' ' . $edate_hh . ':' . $edate_ii;
		$description = $event->content;
	?>

	<div align="center" style="border:1px solid #C9E0ED;border-radius:8px;padding:10px;"><br/>
		<form name="updateevent" id="updateevent" action="" method="post">
			<table style="width:auto;" align="center">
				<tr style="display:block">
					<td style="width:160px;"><b>Заголовок: </b><span style="color:#CC0000;">*</span></td><td><input type="text" name="title" value="<?php echo $title; ?>" id="title"></td>
				</tr>
				<tr style="display:block">
					<td style="width:160px;"><b>Дата начала: </b><span style="color:#CC0000;">*</span></td>
					<td>
					<?php 
						 $this->beginWidget('ext.EJuiTimePicker.EJuiTimePicker', array(
							'name'=>'startdate',
							'value'=>$startTime,
							'options' => array(
								'dateFormat' => 'yy-mm-dd',
							),
							'timeOptions' => array(
								'showOn' => 'focus',
							),
							'language' => 'ru',
							)
						);
					?>
					<?php $this->endWidget('ext.EJuiTimePicker.EJuiTimePicker'); ?>
					</td>
				</tr>
				<tr style="display:block">
					<td style="width:160px;"><b>Дата окончания: </b><span style="color:#CC0000;">*</span></td>
					<td>
					<?php 
						$this->beginWidget('ext.EJuiTimePicker.EJuiTimePicker', array(
							'name'=>'enddate',
							'value'=>$endTime,
							'options' => array(
								'dateFormat' => 'yy-mm-dd',
							),
							'timeOptions' => array(
								'showOn' => 'focus',
							),
							'language' => 'ru',
							)
						);
					?>
					<?php $this->endWidget('ext.EJuiTimePicker.EJuiTimePicker'); ?>
					</td>
				</tr>
				<tr style="display:block">
					<td style="width:160px;"><b>Описание:</b></td><td><textarea name="desc" id="desc" rows="6"><?php echo $description; ?></textarea></td>
				</tr>
				<tr style="display:block">
					<td style="width:160px;"><b>Пригласить: </b><span style="color:#CC0000;">**</span></td>
					<td>
						<select multiple="multiple" name="guests[]">
							  <option value="elcp.conf@gmail.com">Отдел конференций</option>
							  <option value="elcp.subs@gmail.com">Отдел подписки</option>
							  <option value="elcp.promo@gmail.com">Отдел рекламы</option>
							  <option value="input">Ввести вручную</option>
						</select>
                    </td>
				</tr>
				<tr style="display:none" id="fb_from_name">
					<td style="width:160px;"><b>Ваше имя: </b><span style="color:#CC0000;">*</span></td><td><input type="text" name="from_name"></td>
				</tr>	
				<tr style="display:none" id="fb_mtext">
					<td style="width:160px;"><b>Текст письма:</b></td><td><textarea name="mtext" rows="6"></textarea></td>
				</tr>	
				<tr style="display:none" id="fb_email">
					<td style="width:160px;"><b>Email адреса: </b><span style="color:#CC0000;">*</span></td><td><textarea name="guests2" rows="6"></textarea></td>
				</tr>					
				<script type="text/javascript">
					$.fn.myFunction = function() {
						if ($('#invite').val() == "input") {
							document.getElementById('fb_from_name').style.display='block';
							document.getElementById('fb_mtext').style.display='block';
							document.getElementById('fb_email').style.display='block';								
						}
					}
				</script>				
				<tr style="display:block"><td style="width:160px;"></td><td style="font-size: 8pt;"><span style="color:#CC0000;">* Поля обязательные для заполнения</span></td></tr>
				<tr style="display:block"><td style="width:160px;"></td><td style="font-size: 8pt;"><span style="color:#CC0000;">** Для выбора нескольких значений - удерживать Ctrl</span></td></tr>
				<input type="hidden" name="id" value="<?php echo $id; ?>" id="g">
				<tr>
					<td>
						<input type="submit" name="submit" value="Сохранить">
					</td>
					<td>
						<?php
							$this->widget('bootstrap.widgets.TbButton', array(
								'label' => 'Отмена',
								'size' => 'small', 
								'htmlOptions' => array(
											'onclick' => "window.parent.$('#updatedialog').dialog('close');"),
							));
						?>
					</td>	
				</tr>
			</table>
        </form>	
	</div>
  </body>
</html>  